$(document).ready(function() {
	//$.mobile.ajaxLinksEnabled = false;
});

$(document).on("pageinit", function() {

	$("#addcontactForm").submit(function() {
		var content = "<li><a href='person.html' rel='external'><img src='https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQ9meexU-cHE6AZpe_kZ-JiNh2uDwLR_YZgSik9nrS8xksErZBNjA'> <h3>" + 
		                  $("#name").val() + "</h3></img></a></li>"
		$("#contactlist").append(content).listview("refresh");
		return false;
	});

	
	// Add new grouplist
	var nextId = 0;
	$("#add").one('click', function() {
		nextId++;
		var content = "<li><a href='#'>New Group" + nextId + "</a></li>";
		$("#grouplist").append(content).listview("refresh");
	});

	$("#delete").click(function() {
		$("#grouplist").children(":last").remove().listview("refresh");
	});

});

